var _api = _interopRequireDefault(require("../../../../utils/api")), _contactUtil = require("../../../../utils/contact-util"), _user = _interopRequireDefault(require("../../../../public/utils/user"));

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

Page({
    data: {
        list: []
    },
    onLoad: function(t) {
        this.query = t, this.delCardids = [];
        var e = this.$take("radar.user.list");
        this.setData({
            list: e
        });
    },
    onUnload: function() {
        this.delCardids.length && this.$emit("radar.user.del", this.delCardids);
    },
    deleteMember: function(t, e) {
        var i = this, a = t.currentTarget.dataset, r = a.index, s = a.uid, u = a.cardid;
        wx.showModal({
            content: "移除后该成员将不可使用小名片高级版功能权益",
            success: function(t) {
                t.confirm && i.delRequest(r, s, u);
            }
        });
    },
    delRequest: function(e, i, a) {
        var r = this;
        _api.default.minicard.card.setminicardgroupuser({
            data: {
                op: "del",
                cardids: a,
                guid: this.query.guid
            }
        }).then(function() {
            var t = r.data.list;
            t.splice(e, 1), r.setData({
                list: t
            }), r.delCardids.push(a), r.refreshContact(i);
        });
    },
    refreshContact: function(t) {
        +t == +_user.default.getTokensSync().uid && (0, _contactUtil.loadContact)();
    }
});